package com.res.share.service.impl;

import com.res.share.model.ResStatistics;
import com.res.share.mapper.ResStatisticsMapper;
import com.res.share.model.dto.UserStatisModel;
import com.res.share.service.IResStatisticsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 统计 服务实现类
 * </p>
 *
 * @author astupidcoder
 * @since 2021-09-22
 */
@Service
public class ResStatisticsServiceImpl extends ServiceImpl<ResStatisticsMapper, ResStatistics> implements IResStatisticsService {

    @Override
    public UserStatisModel findPersionDetail(Integer userId) {
        return baseMapper.findPersionDetail(userId);
    }

    @Override
    public void insertUserStatis(Integer id) {
        ResStatistics resStatistics=new ResStatistics();
        resStatistics.setUseId(id);
        baseMapper.insert(resStatistics);
    }

    @Override
    public void updateUserScoreNum(Integer userId, Integer score) {
        baseMapper.updateUserScoreNum(userId,score);
    }

    @Override
    public void updateUserResNum(Integer userId, Integer resNum) {
        baseMapper.updateUserResNum(userId,resNum);
    }

    @Override
    public void updateResCollectionNums(Integer userId, Integer type, Integer nums) {
        baseMapper.updateResCollectionNums(userId,type,nums);
    }

    @Override
    public void updateResHistoryNums(Integer userId, Integer type, Integer nums) {
        baseMapper.updateResHistoryNums(userId,type,nums);
    }
}
